package api.string;

import java.util.Scanner;

/**
 *String charAt
 */
public class CharAtDemo {
    public static void main(String[] args) {
        //                    111111---------和下面连接起来成10/11/12/13/14/15
        //          0123456789012345
        String str="thinking in java";
        char c=str.charAt(9);//获取str中下标9所对应的字符
        System.out.println(c);//i

        String q="0123456789abcdefghijklmnopqrstuvqxwz";
        String a="";
        for(int i=0;i<4;i++){
            int s=(int)(Math.random()*36);
            a+=q.charAt(s);
        }

        System.out.println(a);
        Scanner scan=new Scanner(System.in);
        System.out.println("请输入验证码");
        String v=scan.next();
        String b=v.toLowerCase();
        if(b.equals(a)){
            System.out.println("输入正确");
        }else {
            System.out.println("输入错误");
        }
    }
}
